<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="language" content="en" />

    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/bootstrap.css" media="all" />
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/style.css" media="all" />
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/style-k.css" media="all" />
    <link href='http://fonts.googleapis.com/css?family=Comfortaa&subset=latin,cyrillic' rel='stylesheet' type='text/css'>

    <!--    --><?php //Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/jquery-1.11.2.js'); ?>
    <?php Yii::app()->getClientScript()->registerCoreScript('jquery'); ?>
    <?php Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/bootstrap.js'); ?>
    <?php Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/tinymce/tinymce.min.js'); ?>
    <?php Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/script.js'); ?>
	<?php Yii::app()->clientScript->registerScript('googleAnalytics', " (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-53023438-1', 'auto'); ga('send', 'pageview'); "); ?>
    <title><?php echo CHtml::encode($this->pageTitle); ?></title>
</head>
<body>
<?php $imgPath = Yii::app()->request->baseUrl.'/images/design/'?>

    <!--�������� ����-->
    <div class="contain">
        <div class="header">
            <div class="row1">
                <div id="logo"></div>
				<div id="tel">
					<div class="knopka_tel">
						<?php echo Contacts::model()->find()->contacts; ?>
					</div>
				</div>
                <div id="korzina">

                    <div class="tablichka"> <?php
                        $cart_array = array();
                        $json = Yii::app()->request->cookies['cart'];
                        $cart_array = json_decode($json, true);
                        $count = 0;
                        $price = 0;
                        if (is_array($cart_array)){
                            foreach ($cart_array as $key=>$value){
                                $count += $value;
                            }

                            $products = Product::model()->findAllByAttributes(array(
                                'id'=>array_keys($cart_array),
                            ), array(
                                'order'=>'title'
                            ));
                            foreach ($products as $product){
                                $price += $product->price * $cart_array[$product->id];
                            }
                        }
                        ?>
                        <?php echo CHtml::link(
                        "Товаров: " . $count . "<br/><b>" . number_format($price,0,'',' ') . " б.р.</b>", $this->createUrl('/korzina'), array('style'=>'color: #000000;')
						);?>
                    </div>
                    <div class="korzina-number"><?php echo $count;?></div>
                </div>
            </div>
            <div class="row2">

                <div class="myclass">
                    <a href="<?php echo $this->createUrl('/home') ?>" class="knopka <?php echo Yii::app()->request->requestUri==$this->createUrl('/home') ? 'active' : '' ?>">Главная</a>
                    <a href="<?php echo $this->createUrl('/katalog') ?>" class="knopka <?php echo Yii::app()->request->requestUri==$this->createUrl('/katalog') ? 'active' : '' ?>">Каталог</a>
                    <a href="<?php echo $this->createUrl('/stati') ?>" class="knopka <?php echo Yii::app()->request->requestUri==$this->createUrl('/stati') ? 'active' : '' ?>">Статьи</a>
                    <a href="<?php echo $this->createUrl('/novosti') ?>" class="knopka <?php echo Yii::app()->request->requestUri==$this->createUrl('/novosti') ? 'active' : '' ?>">Новости</a>
                    <a href="<?php echo $this->createUrl('/kontakty') ?>" class="knopka <?php echo Yii::app()->request->requestUri==$this->createUrl('/kontakty') ? 'active' : '' ?>">Контакты</a>
                    <a href="<?php echo $this->createUrl('/korzina') ?>" class="knopka <?php echo Yii::app()->request->requestUri==$this->createUrl('/korzina') ? 'active' : '' ?>">Корзина</a>
                </div>

            </div>
        </div>

        <div class="list">
            <!--левая колонка-->
            <div class="lev">
                <?php echo Category::model()->buildAccordion('/subkatalog', Yii::app()->request->getParam('id', null));?>
                        <div class="after-left-menu"></div>
            </div>

            <!--правая колонка-->
            <div class="prav">
                <?php if (isset($this->news)): ?>

                    <div class="novosti">
                        <p>
                        <?php echo CHtml::link($this->news[0]->title, $this->createUrl('/novosti')); ?>
                        </p>
                    </div>
                <?php endif; ?>
                <?php if (isset($this->filter)): ?>
                    <?php $form=$this->beginWidget('CActiveForm', array(
                        'id'=>'category-form',
                        'enableAjaxValidation'=>true,
                        'errorMessageCssClass'=>'alert alert-danger',
                        'htmlOptions'=>array('enctype'=>'multipart/form-data')
                    )); ?>
                    <div class="prav_catalog">
						<div class="filter-head">
							Подбор товара
						</div>
						<div class="filter-body">
						<?php echo $this->filter ?>
						</div>
					</div>
                    <?php $this->endWidget(); ?>
                <?php endif; ?>
            </div>
            <!--центральная часть-->
            <div class="main">
				<!-- breadcrumbs -->
				<?php if(isset($this->breadcrumbs) && $this->breadcrumbs):?>
                    <?php $this->widget('zii.widgets.CBreadcrumbs', array(
                        'links'=>$this->breadcrumbs,
                        'homeLink'=>CHtml::link('Домашняя', Yii::app()->homeUrl),
                        'htmlOptions'=>array('class'=>'hleb')
                    ));
                    ?><!-- breadcrumbs -->
                <?php endif?>
                <?php if(isset($this->pageHeader) && $this->pageHeader):?>
					<?php echo $this->pageHeader ?>
                <?php endif; ?>
                <div class="stati">

                <?php echo $content; ?>
                </div>
                
                    <?php if (isset($this->articles)): ?>
					<div class="stati">
                        <h4>Свежие статьи:</h4>
                        <?php foreach ($this->articles as $article): echo CHtml::link($article->title, $this->createUrl('/statja', array('id'=>$article->id))) . "<br/>"; endforeach; ?>
					</div>
                    <?php endif; ?>
            </div>


        </div>
        <div class="before-footer">

        </div>
    </div>

    <div class="footer">
        <div class="footer-pagetitle">
            <?php echo $this->getPageTitle(); ?>
        </div>

        <div class="copyright">
            <?php echo CHtml::link('© Все права защищены, 2014', $this->createUrl('/site/login')); ?>
        </div>

        <div class="footer-menu">

            <a href="<?php echo $this->createUrl('/home') ?>" class="footer-menu-item <?php echo Yii::app()->request->requestUri==$this->createUrl('/home') ? 'active' : '' ?>">Главная</a> |
            <a href="<?php echo $this->createUrl('/katalog') ?>" class="footer-menu-item <?php echo Yii::app()->request->requestUri==$this->createUrl('/katalog') ? 'active' : '' ?>">Каталог</a> |
            <a href="<?php echo $this->createUrl('/stati') ?>" class="footer-menu-item <?php echo Yii::app()->request->requestUri==$this->createUrl('/stati') ? 'active' : '' ?>">Статьи</a> |
            <a href="<?php echo $this->createUrl('/novosti') ?>" class="footer-menu-item <?php echo Yii::app()->request->requestUri==$this->createUrl('/novosti') ? 'active' : '' ?>">Новости</a> |
            <a href="<?php echo $this->createUrl('/kontakty') ?>" class="footer-menu-item <?php echo Yii::app()->request->requestUri==$this->createUrl('/kontakty') ? 'active' : '' ?>">Контакты</a> |
            <a href="<?php echo $this->createUrl('/korzina') ?>" class="footer-menu-item <?php echo Yii::app()->request->requestUri==$this->createUrl('/korzina') ? 'active' : '' ?>">Корзина</a>
        </div>
    </div>
<div class="after-footer">

</div>

</body>
